package IC.Types;

/**
 * Created by IntelliJ IDEA.
 * User: nimrod
 * Date: 09/01/12
 * Time: 14:19
 * To change this template use File | Settings | File Templates.
 */
public class ArrayType extends Type {
    private Type elementType;

    public ArrayType(Type elementType) {
        super(elementType.getName() + "[]");
        this.elementType = elementType;
    }

    public Type getElementType() {
        return elementType;
    }

    @Override
    public boolean subtypeOf(Type t) {
        // assume single instance per element type
        return t == this;
    }

    @Override
    public boolean isReferenceType() {
        return true;
    }

    @Override
    public String toString() {
        return this.getId() + ": Array type: " + this.getName();
    }
}
